package com.bit.dreamer;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;

public class DreamHelper extends SQLiteOpenHelper {

	final static String DB_NAME = "dreamtest1.db";
	final static int DB_VERSION = 3; 
	
	public DreamHelper(Context context) {
		super(context, DB_NAME, null, DB_VERSION);
	}
	
	public void onCreate(SQLiteDatabase db) {
//		db.execSQL("CREATE TABLE D_do_tb (_id INTEGER PRIMARY KEY AUTOINCREMENT, title TEXT NOT NULL, " +
//				"dreamdate TEXT NOT NULL, img BLOB NOT NULL, memo TEXT NOT NULL, sucess NUMBER, import NUMBER);");
//		db.execSQL("CREATE TABLE D_have_tb (_id INTEGER PRIMARY KEY AUTOINCREMENT, title TEXT NOT NULL, " +
//				"dreamdate TEXT NOT NULL, img BLOB NOT NULL, memo TEXT NOT NULL, sucess NUMBER, import NUMBER);");
//		db.execSQL("CREATE TABLE D_become_tb (_id INTEGER PRIMARY KEY AUTOINCREMENT, title TEXT NOT NULL, " +
//				"dreamdate TEXT NOT NULL, img BLOB NOT NULL, memo TEXT NOT NULL, sucess NUMBER, import NUMBER);");
		db.execSQL("CREATE TABLE D_do_tb (_id INTEGER PRIMARY KEY AUTOINCREMENT, title TEXT NOT NULL, " +
				"dreamdate TEXT NOT NULL, img TEXT NOT NULL, memo TEXT NOT NULL, sucess NUMBER, import NUMBER);");
		db.execSQL("CREATE TABLE D_have_tb (_id INTEGER PRIMARY KEY AUTOINCREMENT, title TEXT NOT NULL, " +
				"dreamdate TEXT NOT NULL, img TEXT NOT NULL, memo TEXT NOT NULL, sucess NUMBER, import NUMBER);");
		db.execSQL("CREATE TABLE D_become_tb (_id INTEGER PRIMARY KEY AUTOINCREMENT, title TEXT NOT NULL, " +
				"dreamdate TEXT NOT NULL, img TEXT NOT NULL, memo TEXT NOT NULL, sucess NUMBER, import NUMBER);");
	
	}
	
	public void onUpgrade(SQLiteDatabase db, int oldVer, int newVer) {
		db.execSQL("DROP TABLE IF EXISTS D_do_tb");
		db.execSQL("DROP TABLE IF EXISTS D_have_tb");
		db.execSQL("DROP TABLE IF EXISTS D_become_tb");
		onCreate(db);
	}

	
}
